﻿// Toolbar is a widget that contains tools
define([
    'Xjs/core/util',
    'Xjs/ui/Control'
],
function (util, Control) {
    'use strict';

    var type = 'toolbar',
    Toolbar = Xjs.getType(type);

    if (Toolbar) { // It has been already loaded
        return Toolbar;
    }

    Toolbar = util.define({
        base: Control,
        construct: function (conf, parent) {
            Toolbar.base.constructor.call(this, conf, parent); // Call the base constructor
        },
        tag: 'div',
        type: type,
        childrenProperty: 'tools',

        addTool: function (tool) {
            this.addChild(tool);
        }
    });

    Xjs.registerType(Toolbar);

    return Toolbar;
});